-
Notifications
You must be signed in to change notification settings - Fork 162
add unit scope for Windows and Registry units #653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add unit scope for Windows and Registry units #653
Conversation
Win64 projects don't list all needed unit scope names
|
I can merge this PR as a short-term fix. But, as there is already a handful of places in the code where Unit Scope names are being used explicitly but inconsistently, I might suggest expanding on this change to include all RTL units that use Unit Scope Names, like |
|
That makes good sense. I wouldn't have been surprised if you wanted to change the compiler directive I used in this commit; I found it used for similar purposes elsewhere and it seemed to work so thought if nothing else, I'd bring attention to it. I like |
|
I changed the target branch for this PR, as I'm going to make further changes before merging everything into master. |
|
If you'd like some help making these changes, let me know how you want to go about it and I can put some time into it. |
|
I added additional changes to the |
|
This last update caused a problem compiling that I didn't expect. I first tried rebuilding the packages in XE8, got an error, thought it might just be an old compiler so tried it in 11 Alexandria but saw the same thing. The period after "System" in the line below causes the compiler to think it's the end of the file even though it's clearly just in a conditional compilation directive: It's gotta be changed to: I'm working through it and will test-compile under several different versions of Delphi before I commit an update. |
|
On second thought, I'm going to abandon this effort. There are way too many of these; it would be far easier to add unit scope names to all the projects. The reason is that anywhere a unit name prefixes a function or procedure or identifier, it has to be a fully qualified unit name, including the unit scope name (see this DocWiki reference). That means not only do we need these |
That's interesting, giving that there were already a few instances of unit scope names being used in this manner, and nobody has complained about this issue before.
Probably for the best. On the other hand, I think there are some
Yes, I saw that, and I think it's quite stupid, IMHO. The compiler should know which units are in the |
|
I have updated the branch with code changes. If we still want to pursue project changes instead of code changes, the code changes can be reverted. |
|
Wow, you really went there:
You must've used global search and replace with regular expressions or have some custom tool to make all those changes that quickly. I tried a couple of techniques but it was just taking too long so backed it all out. I think modifying the project options would be cleaner, easier to read the code. I could fill in the missing project files--I have most versions of Delphi installed on VMs back to XE and even Delphi 7 and 2007. However, I'll build this and see what we get. Probably better to explicitly use the unit names to remove any possibility of ambiguity or remembering to add the unit scopes in future projects. |
|
Oh wait--all you did was change the compiler directive name. It still thinks the "." signifies end of file so we still have the same problem: these won't compile until code like this: |
|
Let me correct myself again--you DID apply this fix to most of the files but there were several more that choked the compile (sorry). I used Claude Code to write a python script to adjust the rest; it found 78 instances in 14 files. I'll create another PR shortly. |
Nope. I'm not good with that stuff. I just used good old fashioned Notepad++ "Find in Files" and copy & pasting.
Yup.
Cool. |
|
I went ahead and merged this particular PR into the master code. We can continue with the other PR to clean things up better. |
|
Sounds good. |
TL;DR: Win64 projects don't list all needed unit scope names.
When trying to compile the Indy libraries for 64-bit, not all unit scope names were defined in the project (couldn't find the Windows or Registry units). Instead of adding unit scope names to every 64-bit package (like they are in the 32-bit packages) for all versions of Delphi (since XE2 when 64-bit compilers were introduced) or requiring Delphi developers to add them to their own Delphi options, just add compiler directives for the handful of places in the source that need it.
I found "VCL_XE2_OR_ABOVE" already defined and convenient so just used that for both Windows and Registry units.